package com.wj.blog.service.impl;

import com.wj.blog.mapper.AboutMapper;
import com.wj.blog.pojo.About;
import com.wj.blog.service.AboutService;
import com.wj.blog.utils.IdWorker;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Author:   wj
 * Date:     2020/4/9 15:20
 * Description:
 */
@Service
public class AboutServiceImpl implements AboutService {

    @Autowired
    AboutMapper aboutMapper;
    @Autowired
    IdWorker idWorker;
    /**
     * 通过id查询
     *
     * @param id
     */
    @Override
    public About getById(String id) {
        return aboutMapper.getById(id);
    }

    /**
     * 添加
     *
     * @param about
     */
    @Override
    public void save(About about) {
        about.setAboutId(idWorker.nextId()+"");
        aboutMapper.save(about);
    }

    /**
     * 删除
     *
     * @param id
     */
    @Override
    public void delete(String id) {
        aboutMapper.delete(id);
    }

    /**
     * 更新
     *
     * @param about
     */
    @Override
    public void update(About about) {
        aboutMapper.update(about);
    }
}
